package com.jsoft.pds.view.beans.base;

import java.io.Serializable;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.jsoft.pds.view.util.BundleResource;

public abstract class BaseBean implements Serializable{

	private static final long serialVersionUID = -8692637431248588836L;
	
	private static final String THEME = "resource";
	
	protected BundleResource bundleResource;

	public String getImageUrl(String name) {
    	return "javax.faces.resource/" + name + ".jsf?ln=" + THEME +"/img&v=3_3_0";
    }
	
	private FacesContext getFacesContext(){
		return FacesContext.getCurrentInstance();
	}
	
	public HttpSession getHttpSession(){
         return (HttpSession) this.getFacesContext().getExternalContext().getSession(false);
	} 
	
	public HttpServletRequest getHttpServletRequest(){
		return (HttpServletRequest) this.getFacesContext().getExternalContext().getRequest();
	}
	
	public BundleResource getBundleResource() {
		return bundleResource;
	}
	public void setBundleResource(BundleResource bundleResource) {
		this.bundleResource = bundleResource;
	}
}
